﻿@using DemoUserInfo.Models
@using Microsoft.AspNet.Identity
@using Microsoft.AspNet.Identity.EntityFramework
@{
    var currentUserId = User.Identity.GetUserId();
    var manager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext()));
    var currentUser = manager.FindById(currentUserId);
}
<div class="row">
    <div class="col-md-offset-4 col-md-8 text-center" style="padding-top: 10%">
        @Html.ActionLink("我要投稿", "Create", "Articles", new { }, new { @class = "btn btn-primary", style = "color:black" })
        <hr />
    </div>


    @if (ViewData["Arts"] == null)
    {
        <div class="col-md-12">
            <small>您还没有上传文章</small>
        </div>
    }
    else
    {
        IQueryable<Article> a = (IQueryable<Article>)ViewData["Arts"];
        <div class="col-md-offset-1">
            <h2><small>我的文章</small></h2>
            @foreach (var item in a)
            {
                <div class="col-md-4 col-xs-6">
                    <div class="showcase">
                        <div class="showcase_time">
                            @item.Date.ToString("yy-MM-dd")
                            <span>@item.Tag</span>
                        </div>
                        <div class="showcase_img">
                            <small id="intro">
                                @item.Introduction
                            </small>
                            <a href=@Url.Action("Details", "Articles", new {id = item.Id}) class="thumbnail">
                                <img src="@Url.Content(item.TitleImgSrc)">
                            </a>
                        </div>
                        <div class="caption showcase_text">
                            <blockquote><h4>@item.Title</h4></blockquote>
                        </div>
                    </div>
                </div>
            }
        </div>

    }
</div>
